package com.example.stu.kudestu;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class SpringbootdemoApplication {

    public static void main(String[] args) {
//        SpringApplication.run(SpringbootdemoApplication.class, args);

        // 获取 Spring Boot 上下文
        ConfigurableApplicationContext ctx = SpringApplication.run(SpringbootdemoApplication.class, args);
        ctx.getEnvironment(); // 获取 边境变量
        System.out.println("===========================================");
        //获取字符串
        System.out.println("读取的配置文件: " + (ctx.getEnvironment().getProperty("server.port") ) );


    }

}
